﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using RandomStudent.Utilities;
using RandomStudent.Entity;
using RandomStudent.Controller;
namespace RandomStudent
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        private MenuItemController itemController = new MenuItemController();
        private const string xmlPath = @"./Data/XMLStudents.xml";
        private static MyClass Class7 = new MyClass();
        public MainWindow()
        {
            InitializeComponent();
            #region testCode

            //List<Student> students = new List<Student>{
            //    new Student{
            //        Name="liming",
            //        Num=1,
            //        Sex="男"
            //    },
            //     new Student{
            //        Name="钱老板",
            //        Num=2,
            //        Sex="女"
            //    },
            //};
            //Class7.Students = students.ToArray();
            //XmlHelper.SaveToXml(xmlPath,Class7,typeof(MyClass),"");

            //MyClass classCopy = new MyClass();
            //classCopy =(MyClass) XmlHelper.LoadFromXml(xmlPath, typeof(MyClass));

            //////add test
            //Student s1 = new Student()
            //{
            //    Name = "3hao",
            //    Num = 3,
            //    Sex = "nv"
            //};
            //XmlHelper.AddToXml(xmlPath, typeof(MyClass), s1);

            //MyClass classCopy = new MyClass();
            //classCopy = (MyClass)XmlHelper.LoadFromXml(xmlPath, typeof(MyClass));
            //bool res=XmlHelper.RemoveFromXml(xmlPath, typeof(MyClass), s1);
            #endregion
            //this.ctrMain.Content = new Controls.LuckyBoy();
            this.muLoadIn.Click += muLoadIn_Click;
            
        }

        void muLoadIn_Click(object sender, RoutedEventArgs e)
        {
            itemController.OpenFileDialog();
        }
    }
}
